﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Web;
using System.Web.Mvc;
using Roy.IService;

namespace Roy.Site.Mvc.Controllers
{
    public class AdminController : Controller
    {
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 顶部
        /// </summary>
        /// <returns></returns>
        public ActionResult Top()
        {
            return View();
        }

        /// <summary>
        /// 底部
        /// </summary>
        /// <returns></returns>
        public ActionResult Bottom()
        {
            return View();
        }

        /// <summary>
        /// 菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult Menu()
        {
            return View();
        }

        /// <summary>
        /// 工作区
        /// </summary>
        /// <returns></returns>
        public ActionResult Workspace()
        {
            return View();
        }

        public JsonResult Test()
        {
            var flag = true;
            var msg = string.Empty;

            using (var factory = new ChannelFactory<IRoyMenuService>("*"))
            {
                try
                {
                    var client = factory.CreateChannel();
                    var result = client.GetAllMenus();
                }
                catch (Exception ex)
                { 
                    
                }
            }

            return Json(new { Success = flag, Msg = msg }, JsonRequestBehavior.AllowGet);
        }
    }
}
